<!DOCTYPE>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>TABLE转换EXCEL</title>
        <script src="http://cdn.bootcss.com/jquery/1.11.0/jquery.min.js" ></script>
        <script src="js/jquery.table2excel.js"></script>
        <style type="text/css">
            .btn{
                margin:20px;
            }
            p{
              padding: 0;
              margin:0;
            }
            table {
                border-collapse: collapse;
                border-spacing: 0;
                border: 1px solid #797979;
            }
            
            td,th {
                padding: 0;
                text-align: center;
            }
            
            .pure-table {
                border-collapse: collapse;
                border-spacing: 0;
                empty-cells: show;
                /* border: 1px solid #cbcbcb; */
            }
            
            .pure-table caption {
                color: #000;
                font: italic 85%/1 arial,sans-serif;
                padding: 1em 0;
                text-align: center;
            }
            
            .pure-table td,.pure-table th {
                border-left: 1px solid #797979;
                border-width: 0 0 0 1px;
                font-size: inherit;
                margin: 0;
                overflow: visible;
                padding: .5em 1em;
            }
            
            .pure-table thead {
                background-color: #e0e0e0;
                color: #000;
                text-align: left;
                vertical-align: bottom;
            }
            
            .pure-table td {
                background-color: transparent;
            }
            
            .pure-table-bordered td {
                border-bottom: 1px solid #797979;
            }
            
            .pure-table-bordered tbody>tr:last-child>td {
                border-bottom-width: 0;
            }

        </style>
    </head>
    <body>
        <center>
            <input class="btn" type="button"  value="点击导出">
            <div class="table2excel pure-table pure-table-bordered">
                <table id = 'testTable' border="1">
                    <tr>
                        <td><p>人数变化</p><p>(元)</p></td>
                        <td>标题二</td>
                        <td>标题三</td>
                    </tr>
                    <tr>
                      <td style="text-align:center;" colspan="2">100</td>
                      <!-- <td>200 (不导出)</td> -->
                      <td>300</td>
                    </tr>
                    <tr>
                      <td rowspan="2">400</td>
                      <td>500</td>
                      <td>600</td>
                    </tr>
                    <tr>
                      <!-- <td>333</td> -->
                      <td>2222</td>
                      <td>111</td>
                    </tr>
                </table>
            </div>
        </center>
        <script type="text/javascript">
            $(function() {
                $(".btn").click(function(){
                    $(".table2excel").table2excel({
                        // 不被导出的表格行的CSS class类
                         exclude: ".noExl",
                        // 导出的Excel文档的名称
                        name: "Excel Document Name",
                        // Excel文件的名称
                        filename: "哈哈哈文件名",
                        //文件后缀名 csv
                        // fileext: ".xlsx",
                        //是否排除导出图片
                        exclude_img: true,
                        //是否排除导出超链接
                        exclude_links: true,
                        //是否排除导出输入框中的内容
                        exclude_inputs: true
                    });
                }); 
            });
        </script>
    </body>
</html>